/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */

/*
 * @Author: xvrui && 3505897045@qq.com
 * @Date: 2024-07-01 15:59:26
 * @LastEditors: RayX 3505897045@qq.com
 * @LastEditTime: 2024-07-06 00:11:37
 * @FilePath: /ns-3.26/src/ipsecinhitipv4/model/ipsecinhitipv4.cc
 * @Description: 
 * 
 */
#include "ipsecinhitipv4.h"
#include "ns3/log.h"
namespace ns3{
    
    // Logger name
    NS_LOG_COMPONENT_DEFINE("IpSecInhitIpv4Logger");
    // register in object system
    NS_OBJECT_ENSURE_REGISTERED(IpSecInhitIpv4);


    /* 
    */
    TypeId IpSecInhitIpv4::GetTypeId(void){
        static TypeId tid = TypeId("ns3::IpSecInhitIpv4")
                                .SetParent<Ipv4L3Protocol>()
                                .AddConstructor<IpSecInhitIpv4>();
        return tid;
    }

    /* constructor and destructor
    // 
    */
    IpSecInhitIpv4::IpSecInhitIpv4(){}
    IpSecInhitIpv4::~IpSecInhitIpv4(){}

    /* send packet
    // @param:
    // 
    */
    void IpSecInhitIpv4::Send(Ptr<Packet> packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol, Ptr<Ipv4Route> route){
        NS_LOG_FUNCTION(this);
        Encrypt();
        Ipv4L3Protocol::Send (packet, source, destination, protocol, route);
    }

    /*
    // @param:
    // 
    */
    void IpSecInhitIpv4::Receive(Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from,
                          const Address &to, NetDevice::PacketType packetType) {
        NS_LOG_FUNCTION(this);
        Decrypt();
        Ipv4L3Protocol::Receive(device,p,protocol,from,to,packetType);
    }

    /*
    // 
    */
    void IpSecInhitIpv4::Encrypt(){
        // TODO
        NS_LOG_DEBUG("Encrypting packet");
        
    }
    
    /*
    // 
    */
    void IpSecInhitIpv4::Decrypt(){
        // TODO
        NS_LOG_DEBUG("Decrypting packet");

    }
}

